<?php

/**
 * UserController
 */

class Application_Controllers_UserController{
    function __construct($action) {
        switch ($action) {
            case 'validate':$this->_validateUser();
                break;
            case 'closeSession':$this->_closeSession();
                break;

            default:
                break;
        }
    }
    
    private function _setterVar(Application_Models_UserModel &$object){
        $object->set_idUser($_POST['username']);
        $object->set_password(md5($_POST['password']));
    }
    
    private function _validateUser(){
        $objModelUser=new Application_Models_UserModel();
        $this->_setterVar($objModelUser);
        $objModelUser->validateUser();
    }
    private function _closeSession(){
        $objModelUser=new Application_Models_UserModel();
        $this->_setterVar($objModelUser);
        $objModelUser->closeSession();
    }

}